import re

target_str = 'There are 6 classer in the computer science major, with 30 students in each class.'

patterns = [
    '\d', '\d+', '^\d', '\d$', '[a-zA-Z]', '^[a-zA-Z]', '[a-zA-Z]$', '^[a-zA-Z]+', '\w+', '^\w', '^\w+', '[\w ,.]+', '^[\w ]+', '[\w ]+.$', '[\w .]+$', '[\w ]+'
]


for pattern in patterns:
    results = re.findall(pattern, target_str)
    print(pattern, ':', results)